import java.util.ArrayList;
import java.util.List;

public class RemoveElement {
    public int removeElement(int[] nums, int val) {
        int cur = 0;
        for (int num : nums) {
            if (num != val) {
                nums[cur] = num;
                cur++;
            }
        }
        return cur;
    }

    public static void main(String[] args) {
        int[] nums = {3,2,2,3};
        RemoveElement removeElement = new RemoveElement();
        int num = removeElement.removeElement(nums, 3);
        System.out.println(num);
    }
}
